﻿using Nasty.Core.Session;
using Nasty.Core.Entity;
using SqlSugar;
using Nasty.Core.Attributes;

namespace Nasty.Core.Entity.System
{
    [SugarTable("SysDictionary", TableDescription = "字典")]
    public class Dictionary : StandardEntity<Dictionary>
    {
        /// <summary>
		/// 名称
		/// </summary>
		[NastyColumn(ColumnName = "Name", ColumnDescription = "名称", Required = true)]
        public string? Name { get; set; }

        /// <summary>
        /// 编码
        /// </summary>
        [NastyColumn(ColumnName = "Code", ColumnDescription = "编码", IsRepeat = true)]
        public string? Code { get; set; }

        /// <summary>
        /// 组编码
        /// </summary>
        [SugarColumn(ColumnName = "GroupCode", IsNullable = true, ColumnDescription = "组编码")]
        public string? GroupCode { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [SugarColumn(ColumnName = "Description", IsNullable = true, ColumnDescription = "描述")]
        public string? Description { get; set; }

        /// <summary>
        /// 自定义扩展字段
        /// </summary>
        [SugarColumn(ColumnName = "Extend", IsNullable = true, ColumnDescription = "自定义扩展字段")]
        public string? Extend { get; set; }


        public override void OnPreAdd()
        {
            base.OnPreAdd();

            var db = AppSession.CurrentDb.Value;
        }
    }
}
